﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace lcs.Web.badness
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Page.DataBind();
            }
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {

            string strErr = "";
            if (this.txtbdesp.Text.Trim().Length == 0)
            {
                strErr += "bdesp不能为空！\\n";
            }            
            if (this.txtbspot.Text.Trim().Length == 0)
            {
                strErr += "bspot不能为空！\\n";
            }
            if (this.txtproject.Text.Trim().Length == 0)
            {
                strErr += "project不能为空！\\n";
            }
            if (this.txtmaterial.Text.Trim().Length == 0)
            {
                strErr += "material不能为空！\\n";
            }           

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string bdesp = this.txtbdesp.Text;
            DateTime bdate = DateTime.Now;
            string bspot = this.txtbspot.Text;
            string project = this.txtproject.Text;
            string material = this.txtmaterial.Text;
            int sid=0;
            sid = int.Parse(hfsid.Value.ToString());
            lcs.Model.badness model = new lcs.Model.badness();
            model.bdesp = bdesp;
            model.bdate = bdate;
            model.bspot = bspot;
            model.project = project;
            model.material = material;
            model.sid = sid;

            lcs.BLL.badness bll = new lcs.BLL.badness();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功！", "Add.aspx");

        }


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("List.aspx");
        }
    }
}
